cmake_minimum_required(VERSION 3.5)

project(lenet)

set(CMAKE_C_COMPILER clang)
set(CMAKE_C_STANDARD 11)

include("cmake/utils.cmake")

set(dep_libs PUBLIC m)

#--- OpenMP
find_package(OpenMP)
if(NOT TARGET OpenMP::OpenMP_CXX AND (OpenMP_CXX_FOUND OR OPENMP_FOUND))
    target_compile_options(${PROJECT_NAME} PRIVATE ${OpenMP_CXX_FLAGS})
endif()

if(OpenMP_CXX_FOUND OR OPENMP_FOUND)
    message(STATUS "Building with OpenMP")
    if(OpenMP_CXX_FOUND)
        list(APPEND dep_libs PUBLIC OpenMP::OpenMP_CXX)
    else()
        list(APPEND dep_libs PRIVATE "${OpenMP_CXX_FLAGS}")
    endif()
endif()

add_executable(lenet
    src/lenet.h
    src/lenet.c
    src/main.c
    src/load_model.h
    src/load_model.c
)

target_link_libraries(lenet ${dep_libs})
